package com.pai4j.client.service;
import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.common.bean.PAIResponseBeanUtil;
import com.pai4j.domain.vo.response.UserBaseResponseInfoVO;
import com.pai4j.domain.vo.response.UserBaseResponseVO;
import com.pai4j.remote.user.UserServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountService {

    @Autowired
    private UserServiceClient userServiceClient;

    /**
     * 获取用户信息
     *
     * @param userId
     * @return
     */
    public UserBaseResponseInfoVO userInfo(String userId) {
        PAIResponseBean<UserBaseResponseInfoVO> responseBean = userServiceClient.getUserBaseInfo(userId);
        if (PAIResponseBeanUtil.isOk(responseBean)) {
            return responseBean.getData();
        }
        // TODO
        return null;
    }

    /**
     * 用户账号查询详情
     *
     * @param account
     * @return
     */
    public UserBaseResponseVO queryAccount( String account) {
        PAIResponseBean<UserBaseResponseVO> responseBean = userServiceClient.userBaseInfo(account);
        if (PAIResponseBeanUtil.isOk(responseBean)) {
            return responseBean.getData();
        }
        // TODO
        return null;
    }
}
